# -*- python -*-
# ex: set syntax=python:
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# See master.experimental/slaves.cfg for documentation.

def linux():
  linux_arm_testers = [9]

  cq_slaves = (range(111, 131) + range(162, 182) + range(250, 399) +
               range(493, 497) + range(520, 540) + range(779, 799))
  cq_builders = [
    'android_chromium_gn_compile_dbg',
    'android_chromium_gn_compile_rel',
    'build_presubmit',
    'cast_shell_android',
    'cast_shell_linux',
    'chromium_presubmit',
    'infra_tester',
    'linux_arm_compile',
    'linux_chromium_asan_rel_ng',
    'linux_chromium_chromeos_compile_dbg_ng',
    'linux_chromium_chromeos_ozone_rel_ng',
    'linux_chromium_chromeos_rel_ng',
    'linux_chromium_clobber_rel_ng',
    'linux_chromium_compile_dbg_ng',
    'linux_chromium_gn_chromeos_dbg',
    'linux_chromium_gn_chromeos_rel',
    'linux_chromium_gn_dbg',
    'linux_chromium_gn_rel',
    'linux_chromium_rel_ng',
  ]
  cq_builders += [
    'chromeos_%s_chromium_compile_only_ng' % (board,)
    for board in ('x86-generic', 'amd64-generic', 'daisy')
  ]

  optional_slaves = [568] + range(714, 719)
  optional_builders = [
    'linux_arm',
    'linux_chromium_chromeos_asan_rel_ng',
    'linux_chromium_chromeos_compile_rel_ng',
    'linux_chromium_chromeos_dbg_ng',
    'linux_chromium_chromeos_msan_rel_ng',
    'linux_chromium_chromeos_ozone_dbg_ng',
    'linux_chromium_compile_rel_ng',
    'linux_chromium_dbg_ng',
    'linux_chromium_gn_upload',
    'linux_chromium_msan_rel_ng',
    'linux_chromium_tsan_rel_ng',
    'linux_chromium_practice_rel_ng',
    'linux_ecs_ozone',
    'linux_nacl_sdk',
    'linux_nacl_sdk_bionic',
    'linux_nacl_sdk_bionic_build',
    'linux_nacl_sdk_build',
    'linux_site_isolation',
  ]

  # Set up normal slaves.
  result = []
  for slave in cq_slaves:
    result.append({
      'master': 'TryServerChromiumLinux',
      'os': 'linux',
      'version': 'precise',
      'bits': '64',
      'builder': cq_builders,
      'hostname': 'slave%d-c4' % slave,
    })
  for slave in optional_slaves:
    result.append({
      'master': 'TryServerChromiumLinux',
      'os': 'linux',
      'version': 'precise',
      'bits': '64',
      'builder': optional_builders,
      'hostname': 'slave%d-c4' % slave,
    })

  result.extend(
    {
      'master': 'TryServerChromiumLinux',
      'os': 'linux',
      'version': 'quantal',
      'bits': '32',
      'builder': 'linux_arm_tester',
      'hostname': 'build%d-a4' % i,
    } for i in linux_arm_testers
  )

  result.extend([
    {
      'master': 'TryServerChromiumLinux',
      'os': 'linux',
      'version': 'trusty',
      'bits': '64',
      'builder': ['linux_chromium_trusty_dbg', 'linux_chromium_trusty_rel'],
      'hostname': 'build25-a4',
    },
    {
      'master': 'TryServerChromiumLinux',
      'os': 'linux',
      'version': 'trusty',
      'bits': '32',
      'builder': ['linux_chromium_trusty32_dbg', 'linux_chromium_trusty32_rel'],
      'hostname': 'build26-a4',
    },
  ])

  # Trusty slave for depot_tools_presubmit
  result.extend([
    {
      'master': 'TryServerChromiumLinux',
      'os': 'linux',
      'version': 'trusty',
      'bits': '64',
      'builder': ['depot_tools_presubmit'],
      'hostname': 'slave426-c4',
    }
  ])

  linux_full_bisect_builder_slaves = [747, 748]
  result.extend(
    {
      'master': 'TryServerChromiumLinux',
      'os': 'linux',
      'version': 'precise',
      'bits': '64',
      'builder': 'linux_full_bisect_builder',
      'hostname': 'slave%d-c4' % i,
    } for i in linux_full_bisect_builder_slaves
  )

  linux_32_slaves = [117, 162, 163, 188, 193, 196, 198, 201, 203,
                     211, 227, 260, 338, 786, 787, 788]
  result.extend(
    {
      'master': 'TryServerChromiumLinux',
      'os': 'linux',
      'version': 'precise',
      'bits': '32',
      'builder': [
          'linux_chromium_compile_dbg_32_ng',
          'linux_chromium_dbg_32_ng',
      ],
      'hostname': 'vm%d-m4' % i,
    } for i in linux_32_slaves
  )

  return result


def android():
  compile_slaves = [
    {
      'master': 'TryServerChromiumLinux',
      'builder': ['android_clang_dbg_recipe',
                  'android_x86_dbg_recipe',
                  'android_arm64_dbg_recipe',
                  'android_compile_dbg',
                  'android_compile_rel'],
      'hostname': 'slave%d-c4' % i,
      'os': 'linux',
      'version': 'precise',
      'bits': '64',
    } for i in range(101, 111) + range(453, 492) + range(749, 767)
  ]

  test_cq_slaves = [
    {
      'master': 'TryServerChromiumLinux',
      'builder': [
          'linux_android_rel_ng'
      ],
      'hostname': 'build%d-a4' % i,
      'os': 'linux',
      'version': 'precise',
      'bits': '64',
    } for i in range(101,139+1)
  ]

  test_optional_slaves = [
    {
      'master': 'TryServerChromiumLinux',
      'builder': [
          'linux_android_dbg_ng',
      ],
      'hostname': 'build%d-a4' % i,
      'os': 'linux',
      'version': 'precise',
      'bits': '64',
    } for i in [100]
  ]

  amp_slaves = [
    {
      'master': 'TryServerChromiumLinux',
      'builder': 'android_amp_rel_tests_recipe',
      'hostname': 'build%d-a4' % i,
      'os': 'linux',
      'version': 'precise',
      'bits': '64',
    } for i in range(225,229+1)
  ]

  return compile_slaves + test_cq_slaves + test_optional_slaves + amp_slaves


slaves = linux() + android()
